<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Timestamp" %>
<%@ page import="top.appx.T" %>
<%
    System.out.println("开始发布文章");

    String path = request.getSession().getServletContext().getRealPath("/");
    path = path.substring(0, path.length() - path.indexOf("blog") + 7) + "docs\\article\\";
    T.articleDic = path;

    System.out.println("开始发布文章1");

    boolean success = false;
    String msg = null;
    try {
        String title = request.getParameter("title");
        String content = request.getParameter("content");
        Timestamp createTime = new Timestamp(System.currentTimeMillis());

        T.add(title,content,createTime);
        System.out.println("发布文章成功");
        success = true;
    }catch (Exception ex) {
        msg = "错误";
        ex.printStackTrace();
    }finally{
%>
{
"success":<%=success%>,
"msg":"<%=msg%>"
}
<%
    }
%>


